export default class BaseService {
	/* 
	interface BaseService(){
		function setCallback()
	}
	 */
	constructor(source,func) {
		this.data=[]
		this.isLoading=true
	}
	//刷新
	refresh(model){
		if(this.isArrayFn(model.data)){
			if(model.data.length==0){
				model=this.arrayisnull(model)
			}
		}else{
			if(Object.keys(model.data).length==0){
				model=this.objectisnull(model)
			}
		}
		this.data=model.data
		this.isLoading=false
	}
	/* 加载更多 */
	loadMore(model){
		this.data=this.data.concat(model.data)
	}
	
	arrayisnull(data){
		return data
	}
	
	objectisnull(data){
		return data
	}
	
	isArrayFn(value) {
		if (typeof Array.isArray === "function") {
			return Array.isArray(value);
		} else {
			return Object.prototype.toString.call(value) === "[object Array]";
		}
	}
}